package com.example.chapter12.dip;

public class Man implements Person {
    private Head head;
    private Heart heart;

    public Man(Heart heart) {
        this.heart = heart;
    }

    @Override
    public void setHead(Head head) {
        this.head = head;
    }

    public void behavior() {
        if (head != null) {
            this.head.think();
        } else {
            System.out.println("没脑子，不思考");
        }
        heart.boom();
    }

}
